/**
 * 
 */
function change() {
	var item = $("#sel").val();
	console.log(item);
	window.location.href = "./MerchantListServlet?isBlack=" + item;
}

$(document).ready(function() {
	$("#rejectDialo #remarks").text()
	var merchantId = ""

	$(".option-btn .apply-button").each(function(index) {
		$(this).click(function(e) {
			var merchantId = $(this).attr("name")
			console.log(merchantId)
			 window.location.href =  "./MerchantApplyServlet?type=apply&merchantId=" + merchantId + "&auditStatus=0"
		})
	})

	$(".option-btn .black-button").each(function(index) {
		$(this).click(function(e) {
			var merchantId = $(this).attr("name")
			var isBlack = $(this).attr("value")
			console.log(merchantId)
			console.log(isBlack)
			
			 window.location.href =
			 "./MerchantApplyServlet?type=isBlack&merchantId=" + merchantId +
			 "&isBlack=" + isBlack;
		})
	})

	$(".option-btn .reject-button").each(function(index) {
		$(this).click(function(e) {
			$('#rejectDialo').dialog()
			merchantId = $(this).attr("name")
		})
	})

	$("#reject-action").click(function() {
		console.log(merchantId)
		var remarks = $("#rejectDialo #remarks").val()
		console.log(remarks)
		$('#rejectDialo').dialog('close')
		 window.location.href =
		 "./MerchantApplyServlet?type=reject&merchantId=" + merchantId +
		 "&remarks=" + remarks;
	})
})
